//https://www.nowcoder.com/practice/0c1b486d987b4269b398fee374584fc8?tpId=13&tqId=2221866&ru=%2Fpractice%2Fef1f53ef31ca408cada5093c8780f44b&qru=%2Fta%2Fcoding-interviews%2Fquestion-ranking&sourceUrl=%2Fexam%2Foj%2Fta%3Fpage%3D1%26tpId%3D13%26type%3D13
//思想：荷兰国旗问题；
#include <iostream>
#include <vector>
using namespace std;

#include <cstddef>
class Solution {
public:
    /**
     * 代码中的类名、方法名、参数名已经指定，请勿修改，直接返回方法规定的值即可
     *
     * 
     * @param array int整型vector 
     * @return int整型vector
     */
    vector<int> reOrderArrayTwo(vector<int>& array) {
        // write code here
        int left = -1;
        int more = array.size();
        for(size_t i=0;i<more;){
            if((array[i]& 1) == 1){
                std::swap(array[++left],array[i++]);
            }else {
                std::swap(array[--more],array[i]);
            }
        }
        return array;
    }
};